package com.cncf.service.impl;

import com.cncf.dao.InvalidReportViewMapper;
import com.cncf.entity.InvalidReportView;
import com.cncf.entity.InvalidReportViewExample;
import com.cncf.service.InvalidReportViewService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
* @author zj 
*/
@Service
public class InvalidReportViewServiceImpl implements InvalidReportViewService {
    @Autowired
    private InvalidReportViewMapper invalidReportViewMapper;

    @Override
    public List<InvalidReportView> getAllInvalidReportView(Integer page, Integer pageSize){
        if (page==null||pageSize==null){
            InvalidReportViewExample invalidReportViewExample=new InvalidReportViewExample();
            return invalidReportViewMapper.selectByExample(invalidReportViewExample);
        }
        int offset = page*pageSize;
        int limit = pageSize;
        return invalidReportViewMapper.selectAllInvalidReportViewByPage(offset,limit);
    }

    @Override
    public int sum() {
        InvalidReportViewExample invalidReportViewExample=new InvalidReportViewExample();
        return (int)invalidReportViewMapper.countByExample(invalidReportViewExample);
    }
}